<?php

namespace App\Http\Requests\Folder;

use App\Http\Requests\AbstractApiRequest;
use Dingo\Api\Http\FormRequest;
use Illuminate\Validation\ValidationException;

class Update extends AbstractApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

     /**
      * Get the validation rules that apply to the request.
      *
      * @return array
      */
     public function rules()
     {
        return [
            'name' => 'sometimes|required',
            'parent' => 'sometimes|required',
        ];
     }

     /**
      * 获取已定义验证规则的错误消息。
      *
      * @return array
      */
     public function messages()
     {
        return [
            'name.required' => '文件夹名称不能为空',
            'parent.required' => '文件夹父id不能为空',
        ];
    }
}
